package com.example.xiaomi.Model.Dao;

import com.example.xiaomi.Model.entity.orderEntity;
import com.example.xiaomi.Model.utils.BaseDB;
import com.example.xiaomi.Model.utils.RowMapper;

import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;

public class orderDao extends BaseDB {

    public Integer doInsert(int oid, int cid, int quantity, BigDecimal osum , String otime , String odeta , String method , String ostate){
        String sql="insert into is_order values(?,?,?,?,?,?,?,?)";
        return super.insert(sql,oid,cid,quantity,osum,otime,odeta,method,ostate);
    }

    class StuRowMapper implements RowMapper<orderEntity> {
        @Override
        public orderEntity rowmap(ResultSet rs) throws SQLException {
            return new orderEntity(rs.getInt("oid"),
                                   rs.getString("cid"),
                                   rs.getInt("quantity"),
                                   rs.getBigDecimal("osum"),
                                   rs.getString("otime"),
                                   rs.getString("odeta"),
                                   rs.getString("method"),
                                   rs.getString("ostate"));
        }
    }
}
